/*
 * Copyright (c) 2010 Nokia Corporation.
 */

import Qt 4.7

Rectangle {
    id: myRectangle

    signal showImage(variant p)

    width: 100
    height: 100
    anchors.fill: parent

    color: "black"

    GridView {
        id: gridView
        property int pictureSize: parent.width/2.5

        // 4,4:     no focus animation
        // 12,4:    focus is shown a second
        // 12, 12:  foucs is visible all the time
        property int focusOnWidth: 4
        property int focusOffWidth: 4
        property bool removeFocus: false

        objectName: "gridView"
        cellWidth: pictureSize; cellHeight: pictureSize
        focus: true
        keyNavigationWraps: true
        anchors.fill: parent
        anchors.margins: (parent.width - pictureSize*2) / 2

        model: pictureModel

        delegate: ListItem {
            id: listItem
            imageHeight: gridView.pictureSize
            selectedRow: listItem.GridView.isCurrentItem ? true : false
            onRowSelected: {
                gridView.currentIndex = model.index
                showImage(listItem.fullpath)
                //console.log(listItem.fullpath)
            }
        }

        transform: Rotation {
            origin.x: width/2
            origin.y: height/2
            axis { x: 0; y: 0; z: 1 }
            angle: 10
        }
    }
}

